home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-portable.exe / quodlibet-3.3.0-portable / data / bin / keyword.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  2KB  |  90 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. '''Keywords (from "graminit.c")
  5.  
  6. This file is automatically generated; please don\'t muck it up!
  7.  
  8. To update the symbols in this file, \'cd\' to the top directory of
  9. the python source tree after building the interpreter and run:
  10.  
  11.     ./python Lib/keyword.py
  12. '''
  13. __all__ = [
  14.     'iskeyword',
  15.     'kwlist']
  16. kwlist = [
  17.     'and',
  18.     'as',
  19.     'assert',
  20.     'break',
  21.     'class',
  22.     'continue',
  23.     'def',
  24.     'del',
  25.     'elif',
  26.     'else',
  27.     'except',
  28.     'exec',
  29.     'finally',
  30.     'for',
  31.     'from',
  32.     'global',
  33.     'if',
  34.     'import',
  35.     'in',
  36.     'is',
  37.     'lambda',
  38.     'not',
  39.     'or',
  40.     'pass',
  41.     'print',
  42.     'raise',
  43.     'return',
  44.     'try',
  45.     'while',
  46.     'with',
  47.     'yield']
  48. iskeyword = frozenset(kwlist).__contains__
  49.  
  50. def main():
  51.     import sys as sys
  52.     import re as re
  53.     args = sys.argv[1:]
  54.     if not args or args[0]:
  55.         pass
  56.     iptfile = 'Python/graminit.c'
  57.     if len(args) > 1:
  58.         optfile = args[1]
  59.     else:
  60.         optfile = 'Lib/keyword.py'
  61.     fp = open(iptfile)
  62.     strprog = re.compile('"([^"]+)"')
  63.     lines = []
  64.     for line in fp:
  65.         if '{1, "' in line:
  66.             match = strprog.search(line)
  67.             if match:
  68.                 lines.append("        '" + match.group(1) + "',\n")
  69.             
  70.     fp.close()
  71.     lines.sort()
  72.     fp = open(optfile)
  73.     format = fp.readlines()
  74.     fp.close()
  75.     
  76.     try:
  77.         start = format.index('#--start keywords--\n') + 1
  78.         end = format.index('#--end keywords--\n')
  79.         format[start:end] = lines
  80.     except ValueError:
  81.         sys.stderr.write('target does not contain format markers\n')
  82.         sys.exit(1)
  83.  
  84.     fp = open(optfile, 'w')
  85.     fp.write(''.join(format))
  86.     fp.close()
  87.  
  88. if __name__ == '__main__':
  89.     main()
  90.